home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / mkmf / RCS / mkmf.hdrs,v < prev    next >
Encoding:
Text File  |  1992-06-10  |  4.6 KB  |  272 lines

  1. head     1.10;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @@;
  7.  
  8.  
  9. 1.10
  10. date     92.06.10.13.04.34;  author jhh;  state Exp;
  11. branches ;
  12. next     1.9;
  13.  
  14. 1.9
  15. date     89.10.09.21.28.00;  author rab;  state Exp;
  16. branches ;
  17. next     1.8;
  18.  
  19. 1.8
  20. date     88.11.10.15.23.59;  author ouster;  state Exp;
  21. branches ;
  22. next     1.7;
  23.  
  24. 1.7
  25. date     88.08.20.18.09.37;  author ouster;  state Exp;
  26. branches ;
  27. next     1.6;
  28.  
  29. 1.6
  30. date     88.08.20.12.40.48;  author ouster;  state Exp;
  31. branches ;
  32. next     1.5;
  33.  
  34. 1.5
  35. date     88.08.13.15.07.56;  author ouster;  state Exp;
  36. branches ;
  37. next     1.4;
  38.  
  39. 1.4
  40. date     88.08.12.14.38.33;  author ouster;  state Exp;
  41. branches ;
  42. next     1.3;
  43.  
  44. 1.3
  45. date     88.07.21.11.35.07;  author douglis;  state Exp;
  46. branches ;
  47. next     1.2;
  48.  
  49. 1.2
  50. date     88.07.20.10.22.28;  author ouster;  state Exp;
  51. branches ;
  52. next     1.1;
  53.  
  54. 1.1
  55. date     88.06.21.16.04.58;  author ouster;  state Exp;
  56. branches ;
  57. next     ;
  58.  
  59.  
  60. desc
  61. @@
  62.  
  63.  
  64. 1.10
  65. log
  66. @make sure all makefiles include TYPE
  67. @
  68. text
  69. @#!/sprite/cmds/csh -f
  70. #
  71. # A script to generate (or regenerate) the Makefile for a directory
  72. # consisting solely of header files.
  73. #
  74. # We assume we were invoked from mkmf.  Parameters passed in from mkmf
  75. # through environment variables:
  76. #
  77. #    MKMFDIR        directory containing prototype makefiles
  78. #    MAKEFILE    name of makefile to create
  79. #    SUBTYPE        additional information, telling whether this
  80. #            is an X directory, Sprite directory, etc.
  81. #
  82.  
  83. #
  84. # Argument processing.  (Generalized form, even though just one flag so far.)
  85. #
  86. while ($#argv >= 1)
  87.     if ("$1" == '-x') then
  88.     set echo
  89.     endif
  90.     shift
  91. end
  92.  
  93. set subtype=$SUBTYPE
  94. set tmp=`expr $cwd : '.*/\(include.*\)$'`
  95. switch ($subtype)
  96.     case sprite:
  97.     set includedir=/sprite/lib/$tmp
  98.     breaksw
  99.     case x:
  100.     set includedir=/a/X/lib/$tmp
  101.     breaksw
  102.     default:
  103.     echo Unknown header subtype "$subtype"
  104.     exit 1
  105. endsw
  106. set pref='[a-z_A-Z]'
  107. set makefile=$MAKEFILE
  108.  
  109. if (-e $makefile.proto) then
  110.     set proto=$makefile.proto
  111. else
  112.     set proto="${MKMFDIR}/Makefile.hdrs"
  113. endif
  114.  
  115. echo "Generating a Makefile for $includedir headers using $proto"
  116.  
  117. set nonomatch
  118. set hdrs =( ${pref}*.h )
  119. #
  120. # Check to see if there were any headers.  The first check (size == 1)
  121. # is only necessary because the second check will cause an error if
  122. # hdrs contains more than 1024 bytes.
  123. #
  124. if ($#hdrs == 1) then
  125.     if ("$hdrs" == "${pref}*.h") set hdrs=()
  126. endif
  127. unset nonomatch
  128. set subDirs="`find * -type d ! -name RCS -prune -print`"
  129. set distdir=($DISTDIR)
  130.  
  131. #
  132. # Use sed to substitute various interesting things into the prototype
  133. # makefile. The code below is a bit tricky because some of the variables
  134. # being substituted in can be very long:  if the substitution is passed
  135. # to sed with "-e", the entire variable must fit in a single shell argument,
  136. # with a limit of 1024 characters.  By generating a separate script file
  137. # for the very long variables, the variables get passed through (to the
  138. # script file) as many arguments, which gets around the length problem.
  139. #
  140.  
  141. rm -f mkmf.tmp.sed
  142. echo s,"@@(HDRS)",$hdrs,g > mkmf.tmp.sed
  143. cat $proto | sed -f mkmf.tmp.sed \
  144.     -e "s,@@(DATE),`date`,g" \
  145.     -e "s,@@(INCLUDEDIR),$includedir,g" \
  146.     -e "s,@@(MAKEFILE),$makefile,g" \
  147.     -e "s,@@(SUBDIRS),$subDirs,g" \
  148.     -e "s,@@(TEMPLATE),$proto,g" \
  149.     -e "s,@@(DISTDIR),$distdir,g" \
  150.     -e "s,@@(TYPE),$subtype,g" \
  151.     > $makefile
  152. rm -f mkmf.tmp.sed
  153. @
  154.  
  155.  
  156. 1.9
  157. log
  158. @Modifications for distribution.
  159. @
  160. text
  161. @d82 1
  162. @
  163.  
  164.  
  165. 1.8
  166. log
  167. @Minor cleanup.
  168. @
  169. text
  170. @d61 1
  171. d81 1
  172. @
  173.  
  174.  
  175. 1.7
  176. log
  177. @Handle header subdirectories better.
  178. @
  179. text
  180. @d75 1
  181. d77 1
  182. a78 1
  183.     -e "s,@@(MAKEFILE),$makefile,g" \
  184. a79 1
  185.     -e "s,@@(DATE),`date`,g" \
  186. @
  187.  
  188.  
  189. 1.6
  190. log
  191. @Don't allow symbolic link in install path:  kernel causes problems.
  192. @
  193. text
  194. @d26 1
  195. a28 1
  196.     set tmp=`expr $cwd : '.*/\(include.*\)$'`
  197. d32 1
  198. a32 1
  199.     set includedir=/a/X/lib/include
  200. @
  201.  
  202.  
  203. 1.5
  204. log
  205. @Set up for X stuff.
  206. @
  207. text
  208. @d32 1
  209. a32 1
  210.     set includedir=/X/lib/include
  211. @
  212.  
  213.  
  214. 1.4
  215. log
  216. @No need to look for MAKEFILE or MACHINES.  Also, be more restrictive
  217. on which headers are exported.
  218. @
  219. text
  220. @d11 2
  221. a13 5
  222. # Variables generated here:
  223. #    makefile    name of the makefile to create
  224. #    pref        prefix pattern that files must match to be included
  225. #    proto        name of prototype makefile to use to create $makefile
  226. #
  227. d25 13
  228. a37 3
  229.  
  230. set type=`expr $cwd : '.*/\(include.*\)$'`
  231. set includedir=/sprite/lib/$type
  232. d47 1
  233. a47 1
  234. echo "Generating a Makefile for headers in $type using $proto"
  235. @
  236.  
  237.  
  238. 1.3
  239. log
  240. @added ability to turn on echoing for all mkmf's invoked.
  241. @
  242. text
  243. @d32 1
  244. a32 6
  245.  
  246. if ($?MAKEFILE) then
  247.     set makefile=$MAKEFILE
  248. else
  249.     set makefile=Makefile
  250. endif
  251. @
  252.  
  253.  
  254. 1.2
  255. log
  256. @Add code to be more careful about long lists of source files.
  257. @
  258. text
  259. @d17 12
  260. @
  261.  
  262.  
  263. 1.1
  264. log
  265. @Initial revision
  266. @
  267. text
  268. @d37 8
  269. a44 1
  270. if ("$hdrs" == "${pref}*.h") set hdrs=()
  271. @
  272.